User

Modified on 2010/12/01 15:24 by John — Categorized as: Jetfire Core

User

A 'User' is a workflow object that has first class attributes. When client nexus is started there a user must login. If no user is specified the 'Guest User' is logged in.

A user may have one or more roles assigned. Roles give a user special abilities (see role for details).

Guest User

The "Guest User" is automatically created when Jetfire is started for the first time. No other users need be created unless advanced functionality is required.

Creating a User

A Jetfire User can be created programatically just like creating any workflow object. A User can be created by 2 techniques.

Jetfire 'new' Operator

namespace NewUserExample
{
public workflow Factory
{
// A method that creates a new User object.
public User CreateUser(string userName)
{
// the new operator creates a new instance
// of a User object;
return new User(userName);
}
}
}

Creating a User with a Role

A Jetfire User can have roles added programatically. To create a role see 'Creating a Jetfire Role'.

Jetfire Code to Create a New User with a Role

namespace NewUserExample
{
public workflow UserRoleFactory
{
// A method that creates a new User object.
public User CreateUser(string userName, Role role)
{
// the new operator creates a new instance
// of a User object;
User user = new User(userName);
user.AddRole(role);
return user;
}
}
}